<template>
  <el-form-item>
    <Editor :defaultHtml="tempText" @changeContent="changeContent" v-model="tempText"></Editor>
  </el-form-item>
</template>

<script>
import Editor from '../../components/Editor';

export default {
  name: 'attr-props-text',
  components: {
    Editor,
  },
  props: {
    text: String,
  },
  data() {
    return {
      tempText: '',
    };
  },
  mounted() {
    this.tempText = this.text;
  },
  watch: {
    text() {
      this.tempText = this.text;
    },
    // tempText() {
    //   this.$emit('update:text', this.tempText);
    // },
  },
  methods: {
    changeContent(html) {
      this.tempText = html;
      this.$emit('update:text', this.tempText);
    },
  },
};
</script>

<style scoped>

</style>
